home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / pack / decrunchlib / declib_test.s
Text File  |  1980-01-03  |  2KB  |  57 lines

  1. _LVOAllocCrunchInfo    =    -30
  2. _LVOFreeCrunchInfo    =    -36
  3. _LVOGetCruncher        =    -42
  4. _LVODecrunch        =    -48
  5. ci_name            =    4
  6. ci_decdata        =    8
  7. ci_declen        =    12
  8. ci_packtype        =    21
  9.  
  10.         moveq    #33,d0            ;version of library to open
  11.         lea    DecName(pc),a1        ;ptr to libname
  12.         CallExec OpenLibrary        ;open library
  13.         beq.s    OpenDecErr        ;did we open it okay?
  14.         move.l    d0,DecBase        ;save base address of library
  15.  
  16. TestPack    move.l    d0,a6            ;base of decrunch lib
  17.         CallOS    AllocCrunchInfo        ;allocate memory buffers
  18.         tst.l    d0            ;did we succeed?
  19.         beq.s    AllocDecErr        ;exit if failed!
  20.         move.l    d0,a4            ;a4=base address
  21.  
  22.         move.l    FilePtr(pc),a0        ;ptr to our filebuffer
  23.  
  24.         move.l    a0,(a4)            ;save it into structure
  25.         move.l    a4,a0            ;move structptr from a4 to a0
  26.         CallOS    GetCruncher        ;try to identify cruncher
  27.         tst.l    d0            ;did we get one?
  28.         beq.s    NotKnown        ;nope, un identified!
  29.  
  30.         move.l    a4,a0            ;a0=struct
  31.         CallOS    Decrunch        ;decrunch it!
  32.         tst.l    d0            ;did we succeed?
  33.         beq.s    DecrunchErr        ;nope, exit!
  34.         
  35.         move.l    ci_declen(a4),d0    ;unpacked length
  36.         move.l    ci_decdata(a4),d2    ;unpacked buffer
  37.         move.l    ci_name(a4),d3        ;name of cruncher
  38.         move.b    ci_packtype(a4),d4    ;pack type (reloc/abs)
  39.                 
  40. waity        move.w    $dff006,$dff180
  41.         btst    #6,$bfe001
  42.         bne.s    waity
  43. NotKnown
  44. DecrunchErr    move.l    DecBase(pc),a6        ;a6=base of decrunch lib
  45.         move.l    a4,a0            ;a0=dec struct
  46.         CallOS    FreeCrunchInfo        ;free allocated decrunchbuffer
  47.  
  48. AllocDecErr    move.l    DecBase(pc),a1        ;base of decrunch lib to close
  49.         CallExec CloseLibrary        ;close the library!
  50.  
  51. OpenDecErr    moveq    #0,d0            ;no error code
  52.         rts                ;bye bye!!!!!
  53.  
  54. DecName        dc.b    'decrunch.library',0
  55.         even
  56. DecBase        ds.l    1
  57.